using System;
using Castle.MicroKernel;
using Castle.MicroKernel.Registration;
using SpecMaker.Core.Interfaces;

namespace SpecMaker.Core
{
    public class WindsorAppConfig
    {
        public virtual ISpecRunner InitializeRunner(Type factory)
        {
            var kernel = new DefaultKernel();
            kernel.Register(
                AllTypes.Pick().
                FromAssembly(GetType().Assembly).
                WithService.FirstInterface().
                Configure(c=>c.LifeStyle.Transient));
//           kernel.Register(
//
//                Component.For<IAssemblyTypeLoader>().ImplementedBy<FileLocAssemblyLoader>().LifeStyle.Transient,
//                Component.For<ISpecFinder>().ImplementedBy<SpecFinder>().LifeStyle.Transient,
//                Component.For<RuleExecutor>(),
//                Component.For<IOutputWrapper>().ImplementedBy<ProdConsole>(),
//                Component.For<IReportFactory>().ImplementedBy(factory),
//                Component.For<ISpecRunner>().ImplementedBy<SpecRunner>(),
//                Component.For<IIOWriter>().ImplementedBy<FileWriter>()
//                );
            return kernel.Resolve<ISpecRunner>();
        }
    }
}